package com.geostar.constructionland.index.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.geostar.constructionland.index.entity.model.InxOutStorageUnFreezeModel;
import com.geostar.constructionland.index.entity.vo.SelInxOutStorageAcotData;
import com.geostar.constructionland.index.entity.model.InxOutStogAcotModel;
import com.geostar.constructionland.index.service.InxOutStorageAcotService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/***
 * 出库台账
 * @author df
 */
@RestController
@RequestMapping("/inxoutstorageacot")
@Api(tags = "出库台账相关接口")
public class InxOutStorageAcotController {
    @Resource
    InxOutStorageAcotService inxOutStorageAcotService;

    @ApiOperation(value = "获取出库台账信息列表", notes = "获取出库台账信息列表，必须设置分页参数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pagenum", value = "页码", required = true),
            @ApiImplicitParam(name = "pagesize", value = "页数", required = true),
            @ApiImplicitParam(name = "distCodeProvince", value = "省区划代码 xzqhdm_province"),
            @ApiImplicitParam(name = "distCodeCity", value = "市区划代码 xzqhdm_city"),
            @ApiImplicitParam(name = "distCodeCountry", value = "县区划代码 xzqhdm_country"),
            @ApiImplicitParam(name = "indexYear", value = "指标年度 zbnf"),
            @ApiImplicitParam(name = "projectName", value = "项目名称 xmmc"),
            @ApiImplicitParam(name = "businessType", value = "业务类型 xmalx"),
            @ApiImplicitParam(name = "indexType", value = "指标业务类型 zblx"),
            @ApiImplicitParam(name = "sortOrder", value = "排序类型 "),
            @ApiImplicitParam(name = "sortName", value = "排序字段 "),
            @ApiImplicitParam(name = "outStorageStatus", value = "出库状态 "),
            @ApiImplicitParam(name = "inxStorageId", value = "入库id "),
            @ApiImplicitParam(name = "outStorageType", value = "出库类型 cklx"),
    })
    @PostMapping(value = "/list")
    @ResponseBody
    public IPage<SelInxOutStorageAcotData> queryInxStorageList(@Valid InxOutStogAcotModel inxOutStogAcotModel) {
        return inxOutStorageAcotService.queryInxOutStogAcotList(inxOutStogAcotModel);
    }

    @ApiOperation(value = "获取出库台账信息列表集合不分页", notes = "获取出库台账信息列表")
    @PostMapping(value = "/listAll")
    @ResponseBody
    public List<SelInxOutStorageAcotData> queryInxStorageAllList(@Valid InxOutStogAcotModel inxOutStogAcotModel){
        return inxOutStorageAcotService.queryInxStorageAllList(inxOutStogAcotModel);
    }

    @ApiOperation(value = "指标解冻")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "inxOutStorageId",value = "出库id"),
            @ApiImplicitParam(name = "operatorId",value = "用户id"),
            @ApiImplicitParam(name = "operatorName",value = "用户名"),
            @ApiImplicitParam(name = "buildLandAdd",value = "新增建设用地（冻结指标）"),
            @ApiImplicitParam(name = "agclLand",value = "农用地（冻结指标）"),
            @ApiImplicitParam(name = "farmland",value = "耕地（冻结指标）"),
            @ApiImplicitParam(name = "remark",value = "备注"),
    })
    @PostMapping(value = "/indexUnfreeze")
    @ResponseBody
    public String inxOutStorageUnFreeze(@Valid InxOutStorageUnFreezeModel inxOutStorageUnFreezeModal){
        return inxOutStorageAcotService.inxOutStorageUnFreeze(inxOutStorageUnFreezeModal);
    }
}
